<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta
      name="viewport"
      content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"
    />
    <title>中国南方电网</title>
    <link rel="icon" href="/favicon.ico" type="image/x-icon" />
  </head>
  <body>
    <noscript>Sorry, we need js to run correctly!</noscript>
    <div id="root"></div>
    <script src="/config/index.js"></script>
    <script>
      var baseUrl = webUrl+'custom/static/js/qzkf.config.js';
      // var baseUrl = webUrl;
      var head= document.getElementsByTagName('head')[0];
      var script= document.createElement('script');
      script.type= 'text/javascript';
      script.src= baseUrl;
      script.id='qizhiChatScript';
      head.appendChild(script);
      var checkAction;
      //判断长时间未操作就退出登录
      var lastTime = new Date().getTime();
      var currentTime = new Date().getTime();
      var timeOut = 30 * 60 * 1000; //设置超时时间： 30分钟

      (function(){
        /* 监听鼠标移动事件 */
        if (document.addEventListener) { //FireFox,Chrome,Opera…
          document.addEventListener('mousemove',function() {
            lastTime = new Date().getTime(); //更新操作时间
          },false); //事件会在鼠标指针移动时发生。
        }
      }());

      function testTime(){
        currentTime = new Date().getTime(); //更新当前时间
        if(currentTime - lastTime > timeOut){ //判断是否超时
          console.log("登录超时，请重新登录");
          localStorage.clear();
          window.g_app._store.dispatch({
            type: 'login/logout',
          });
        }
      }
      /* 定时器 间隔1秒检测是否长时间未操作页面 */
      window.setInterval(testTime, 1000);
    </script>
  </body>
</html>
